        <!DOCTYPE html>
        <html>
        <head>
                <meta charset="utf-8">
        <title>DebugDraw abstract class / box2d_html Library / Dart Documentation</title>
        <link rel="stylesheet" type="text/css"
            href="../styles.css">
        <link href="http://fonts.googleapis.com/css?family=Open+Sans:400,600,700,800" rel="stylesheet" type="text/css">
        <link rel="shortcut icon" href="../favicon.ico">
        
        </head>
        <body data-library="box2d_html" data-type="DebugDraw">
        <div class="page">
        <div class="header">
          <a href="../index.html"><div class="logo"></div></a>
          <a href="../index.html">Dart Documentation</a>
         &rsaquo; <a href="../box2d_html.html">box2d_html</a> &rsaquo; <a href="../box2d_html/DebugDraw.html">DebugDraw</a>        <div id="search-box">
          <input type="search" name="q" id="q" autocomplete="off"
              class="search-input" placeholder="Search API">
        </div>
        
      </div>
      <div class="drop-down" id="drop-down"></div>
      
        <div class="nav">
        
</div>
<div class="content">
        <h2><strong>DebugDraw</strong>
          abstract class
        </h2>
        
<button id="show-inherited" class="show-inherited">Hide inherited</button>
<div class="doc">
<p>Implement this abstract class to allow DartBox2d to
automatically draw your physics for debugging purposes.
Not intended to replace your own custom rendering
routines! Draws shapes by default.</p>
<pre class="source">
abstract class DebugDraw {
  // TODO(gregbglw): Draw joints once have them implemented. Also draw other
  // neat stuff described below.

  /// draw shapes
  static const int e_shapeBit = 0x0001;
  /// draw joint connections
  static const int e_jointBit = 0x0002;
  /// draw core (TimeOfImpact) shapes
  static const int e_aabbBit = 0x0004;
  /// draw axis aligned boxes
  static const int e_pairBit = 0x0008;
  /// draw center of mass 
  static const int e_centerOfMassBit = 0x0010;
  /// draw dynamic tree.
  static const int e_dynamicTreeBit = 0x0020;
  /// draw with lines (vs. default filled polygons).
  static const int e_lineDrawingBit = 0x0040;

  int flags;
  IViewportTransform viewportTransform;

  DebugDraw(IViewportTransform viewport)
      : flags = e_shapeBit,
        viewportTransform = viewport;

  void appendFlags(int value) { flags |= value; }
  void clearFlags(int value) { flags &amp;= ~value; }

  /** Draw a closed polygon provided in CCW order. */
  abstract void drawPolygon(List&lt;Vector&gt; vertices, int vertexCount,
      Color3 color);

  /** Draws the given point with the given radius and color.  */
  abstract void drawPoint(Vector point, num radiusOnScreen, Color3 color);

  /** Draw a solid closed polygon provided in CCW order. */
  abstract void drawSolidPolygon(List&lt;Vector&gt; vertices, int vertexCount,
      Color3 color);

  /** Draw a circle. */
  abstract void drawCircle(Vector center, num radius, Color3 color,
      [Vector axis]);

  /** Draw a solid circle. */
  abstract void drawSolidCircle(Vector center, num radius, Color3 color,
      [Vector axis]);

  /** Draw a line segment. */
  abstract void drawSegment(Vector p1, Vector p2, Color3 color);

  /** Draw a transform.  Choose your own length scale. */
  abstract void drawTransform(Transform xf, Color3 color);

  /** Draw a string. */
  // TODO(dominich): font.
  abstract void drawString(num x, num y, String s, Color3 color);

  /**
   * Sets the center of the viewport to the given x and y values and the
   * viewport scale to the given scale.
   */
  void setCamera(num x, num y, num scale) {
    viewportTransform.setCamera(x,y,scale);
  }

  /**
   * Screen coordinates are specified in argScreen. These coordinates are
   * converted to World coordinates and placed in the argWorld return vector.
   */
  void getScreenToWorldToOut(Vector argScreen, Vector argWorld) {
    viewportTransform.getScreenToWorld(argScreen, argWorld);
  }

  /**
   * World coordinates are specified in argWorld. These coordinates are
   * converted to screen coordinates and placed in the argScreen return vector.
   */
  void getWorldToScreenToOut(Vector argWorld, Vector argScreen) {
    viewportTransform.getWorldToScreen(argWorld, argScreen);
  }
}
</pre>
</div>
<h3>Subclasses</h3>
<p>
<span class="type-box"><span class="icon-class"></span><a href="../box2d_html/CanvasDraw.html">CanvasDraw</a></span></p>
<div>
<h3>Constructors</h3>
<div class="method"><h4 id="DebugDraw">
<button class="show-code">Code</button>
new <strong>DebugDraw</strong>(<a href="../box2d_html/IViewportTransform.html">IViewportTransform</a> viewport) <a class="anchor-link" href="#DebugDraw"
              title="Permalink to DebugDraw.DebugDraw">#</a></h4>
<div class="doc">
<pre class="source">
DebugDraw(IViewportTransform viewport)
    : flags = e_shapeBit,
      viewportTransform = viewport;
</pre>
</div>
</div>
</div>
<div>
<h3>Static Properties</h3>
<div class="field"><h4 id="e_aabbBit">
<button class="show-code">Code</button>
const int         <strong>e_aabbBit</strong> <a class="anchor-link"
            href="#e_aabbBit"
            title="Permalink to DebugDraw.e_aabbBit">#</a>
        </h4>
        <div class="doc">
<p>draw core (TimeOfImpact) shapes</p>
<pre class="source">
static const int e_aabbBit = 0x0004;
</pre>
</div>
</div>
<div class="field"><h4 id="e_centerOfMassBit">
<button class="show-code">Code</button>
const int         <strong>e_centerOfMassBit</strong> <a class="anchor-link"
            href="#e_centerOfMassBit"
            title="Permalink to DebugDraw.e_centerOfMassBit">#</a>
        </h4>
        <div class="doc">
<p>draw center of mass </p>
<pre class="source">
static const int e_centerOfMassBit = 0x0010;
</pre>
</div>
</div>
<div class="field"><h4 id="e_dynamicTreeBit">
<button class="show-code">Code</button>
const int         <strong>e_dynamicTreeBit</strong> <a class="anchor-link"
            href="#e_dynamicTreeBit"
            title="Permalink to DebugDraw.e_dynamicTreeBit">#</a>
        </h4>
        <div class="doc">
<p>draw dynamic tree.</p>
<pre class="source">
static const int e_dynamicTreeBit = 0x0020;
</pre>
</div>
</div>
<div class="field"><h4 id="e_jointBit">
<button class="show-code">Code</button>
const int         <strong>e_jointBit</strong> <a class="anchor-link"
            href="#e_jointBit"
            title="Permalink to DebugDraw.e_jointBit">#</a>
        </h4>
        <div class="doc">
<p>draw joint connections</p>
<pre class="source">
static const int e_jointBit = 0x0002;
</pre>
</div>
</div>
<div class="field"><h4 id="e_lineDrawingBit">
<button class="show-code">Code</button>
const int         <strong>e_lineDrawingBit</strong> <a class="anchor-link"
            href="#e_lineDrawingBit"
            title="Permalink to DebugDraw.e_lineDrawingBit">#</a>
        </h4>
        <div class="doc">
<p>draw with lines (vs. default filled polygons).</p>
<pre class="source">
static const int e_lineDrawingBit = 0x0040;
</pre>
</div>
</div>
<div class="field"><h4 id="e_pairBit">
<button class="show-code">Code</button>
const int         <strong>e_pairBit</strong> <a class="anchor-link"
            href="#e_pairBit"
            title="Permalink to DebugDraw.e_pairBit">#</a>
        </h4>
        <div class="doc">
<p>draw axis aligned boxes</p>
<pre class="source">
static const int e_pairBit = 0x0008;
</pre>
</div>
</div>
<div class="field"><h4 id="e_shapeBit">
<button class="show-code">Code</button>
const int         <strong>e_shapeBit</strong> <a class="anchor-link"
            href="#e_shapeBit"
            title="Permalink to DebugDraw.e_shapeBit">#</a>
        </h4>
        <div class="doc">
<p>draw shapes</p>
<pre class="source">
static const int e_shapeBit = 0x0001;
</pre>
</div>
</div>
</div>
<div>
<h3>Properties</h3>
<div class="field"><h4 id="flags">
<button class="show-code">Code</button>
int         <strong>flags</strong> <a class="anchor-link"
            href="#flags"
            title="Permalink to DebugDraw.flags">#</a>
        </h4>
        <div class="doc">
<pre class="source">
int flags;
</pre>
</div>
</div>
<div class="field inherited"><h4 id="runtimeType">
<button class="show-code">Code</button>
final Type         <strong>runtimeType</strong> <a class="anchor-link"
            href="#runtimeType"
            title="Permalink to DebugDraw.runtimeType">#</a>
        </h4>
        <div class="inherited-from">inherited from Object </div><div class="doc">
<p>A representation of the runtime type of the object.</p>
<pre class="source">
external Type get runtimeType;
</pre>
</div>
</div>
<div class="field"><h4 id="viewportTransform">
<button class="show-code">Code</button>
<a href="../box2d_html/IViewportTransform.html">IViewportTransform</a>         <strong>viewportTransform</strong> <a class="anchor-link"
            href="#viewportTransform"
            title="Permalink to DebugDraw.viewportTransform">#</a>
        </h4>
        <div class="doc">
<pre class="source">
IViewportTransform viewportTransform;
</pre>
</div>
</div>
</div>
<div>
<h3>Operators</h3>
<div class="method inherited"><h4 id="==">
<button class="show-code">Code</button>
bool <strong>operator ==</strong>(other) <a class="anchor-link" href="#=="
              title="Permalink to DebugDraw.operator ==">#</a></h4>
<div class="inherited-from">inherited from Object </div><div class="doc">
<p>The equality operator.</p>
<p>The default behavior for all <code>Object</code>s is to return true if and
only if <code>this</code> and 
<span class="param">other</span> are the same object.</p>
<p>If a subclass overrides the equality operator it should override
the <code>hashCode</code> method as well to maintain consistency.</p>
<pre class="source">
bool operator ==(other) =&gt; identical(this, other);
</pre>
</div>
</div>
</div>
<div>
<h3>Methods</h3>
<div class="method"><h4 id="appendFlags">
<button class="show-code">Code</button>
void <strong>appendFlags</strong>(int value) <a class="anchor-link" href="#appendFlags"
              title="Permalink to DebugDraw.appendFlags">#</a></h4>
<div class="doc">
<pre class="source">
void appendFlags(int value) { flags |= value; }
</pre>
</div>
</div>
<div class="method"><h4 id="clearFlags">
<button class="show-code">Code</button>
void <strong>clearFlags</strong>(int value) <a class="anchor-link" href="#clearFlags"
              title="Permalink to DebugDraw.clearFlags">#</a></h4>
<div class="doc">
<pre class="source">
void clearFlags(int value) { flags &amp;= ~value; }
</pre>
</div>
</div>
<div class="method"><h4 id="DebugDraw">
<button class="show-code">Code</button>
new <strong>DebugDraw</strong>(<a href="../box2d_html/IViewportTransform.html">IViewportTransform</a> viewport) <a class="anchor-link" href="#DebugDraw"
              title="Permalink to DebugDraw.DebugDraw">#</a></h4>
<div class="doc">
<pre class="source">
DebugDraw(IViewportTransform viewport)
    : flags = e_shapeBit,
      viewportTransform = viewport;
</pre>
</div>
</div>
<div class="method"><h4 id="drawCircle">
abstract void <strong>drawCircle</strong>(<a href="../box2d_html/Vector.html">Vector</a> center, num radius, <a href="../box2d_html/Color3.html">Color3</a> color, [<a href="../box2d_html/Vector.html">Vector</a> axis]) <a class="anchor-link" href="#drawCircle"
              title="Permalink to DebugDraw.drawCircle">#</a></h4>
<div class="doc">
<p>Draw a circle.</p>
</div>
</div>
<div class="method"><h4 id="drawPoint">
abstract void <strong>drawPoint</strong>(<a href="../box2d_html/Vector.html">Vector</a> point, num radiusOnScreen, <a href="../box2d_html/Color3.html">Color3</a> color) <a class="anchor-link" href="#drawPoint"
              title="Permalink to DebugDraw.drawPoint">#</a></h4>
<div class="doc">
<p>Draws the given point with the given radius and color.</p>
</div>
</div>
<div class="method"><h4 id="drawPolygon">
abstract void <strong>drawPolygon</strong>(List&lt;<a href="../box2d_html/Vector.html">Vector</a>&gt; vertices, int vertexCount, <a href="../box2d_html/Color3.html">Color3</a> color) <a class="anchor-link" href="#drawPolygon"
              title="Permalink to DebugDraw.drawPolygon">#</a></h4>
<div class="doc">
<p>Draw a closed polygon provided in CCW order.</p>
</div>
</div>
<div class="method"><h4 id="drawSegment">
abstract void <strong>drawSegment</strong>(<a href="../box2d_html/Vector.html">Vector</a> p1, <a href="../box2d_html/Vector.html">Vector</a> p2, <a href="../box2d_html/Color3.html">Color3</a> color) <a class="anchor-link" href="#drawSegment"
              title="Permalink to DebugDraw.drawSegment">#</a></h4>
<div class="doc">
<p>Draw a line segment.</p>
</div>
</div>
<div class="method"><h4 id="drawSolidCircle">
abstract void <strong>drawSolidCircle</strong>(<a href="../box2d_html/Vector.html">Vector</a> center, num radius, <a href="../box2d_html/Color3.html">Color3</a> color, [<a href="../box2d_html/Vector.html">Vector</a> axis]) <a class="anchor-link" href="#drawSolidCircle"
              title="Permalink to DebugDraw.drawSolidCircle">#</a></h4>
<div class="doc">
<p>Draw a solid circle.</p>
</div>
</div>
<div class="method"><h4 id="drawSolidPolygon">
abstract void <strong>drawSolidPolygon</strong>(List&lt;<a href="../box2d_html/Vector.html">Vector</a>&gt; vertices, int vertexCount, <a href="../box2d_html/Color3.html">Color3</a> color) <a class="anchor-link" href="#drawSolidPolygon"
              title="Permalink to DebugDraw.drawSolidPolygon">#</a></h4>
<div class="doc">
<p>Draw a solid closed polygon provided in CCW order.</p>
</div>
</div>
<div class="method"><h4 id="drawString">
abstract void <strong>drawString</strong>(num x, num y, String s, <a href="../box2d_html/Color3.html">Color3</a> color) <a class="anchor-link" href="#drawString"
              title="Permalink to DebugDraw.drawString">#</a></h4>
<div class="doc">
<p>Draw a string.</p>
</div>
</div>
<div class="method"><h4 id="drawTransform">
abstract void <strong>drawTransform</strong>(<a href="../box2d_html/Transform.html">Transform</a> xf, <a href="../box2d_html/Color3.html">Color3</a> color) <a class="anchor-link" href="#drawTransform"
              title="Permalink to DebugDraw.drawTransform">#</a></h4>
<div class="doc">
<p>Draw a transform.  Choose your own length scale.</p>
</div>
</div>
<div class="method"><h4 id="getScreenToWorldToOut">
<button class="show-code">Code</button>
void <strong>getScreenToWorldToOut</strong>(<a href="../box2d_html/Vector.html">Vector</a> argScreen, <a href="../box2d_html/Vector.html">Vector</a> argWorld) <a class="anchor-link" href="#getScreenToWorldToOut"
              title="Permalink to DebugDraw.getScreenToWorldToOut">#</a></h4>
<div class="doc">
<p>Screen coordinates are specified in argScreen. These coordinates are
converted to World coordinates and placed in the argWorld return vector.</p>
<pre class="source">
void getScreenToWorldToOut(Vector argScreen, Vector argWorld) {
  viewportTransform.getScreenToWorld(argScreen, argWorld);
}
</pre>
</div>
</div>
<div class="method"><h4 id="getWorldToScreenToOut">
<button class="show-code">Code</button>
void <strong>getWorldToScreenToOut</strong>(<a href="../box2d_html/Vector.html">Vector</a> argWorld, <a href="../box2d_html/Vector.html">Vector</a> argScreen) <a class="anchor-link" href="#getWorldToScreenToOut"
              title="Permalink to DebugDraw.getWorldToScreenToOut">#</a></h4>
<div class="doc">
<p>World coordinates are specified in argWorld. These coordinates are
converted to screen coordinates and placed in the argScreen return vector.</p>
<pre class="source">
void getWorldToScreenToOut(Vector argWorld, Vector argScreen) {
  viewportTransform.getWorldToScreen(argWorld, argScreen);
}
</pre>
</div>
</div>
<div class="method inherited"><h4 id="hashCode">
<button class="show-code">Code</button>
int <strong>hashCode</strong>() <a class="anchor-link" href="#hashCode"
              title="Permalink to DebugDraw.hashCode">#</a></h4>
<div class="inherited-from">inherited from Object </div><div class="doc">
<p>Get a hash code for this object.</p>
<p>All objects have hash codes. Hash codes are guaranteed to be the
same for objects that are equal when compared using the equality
operator <code>==</code>. Other than that there are no guarantees about
the hash codes. They will not be consistent between runs and
there are no distribution guarantees.</p>
<p>If a subclass overrides <code>hashCode</code> it should override the
equality operator as well to maintain consistency.</p>
<pre class="source">
external int hashCode();
</pre>
</div>
</div>
<div class="method inherited"><h4 id="noSuchMethod">
<button class="show-code">Code</button>
<strong>noSuchMethod</strong>(String name, List args) <a class="anchor-link" href="#noSuchMethod"
              title="Permalink to DebugDraw.noSuchMethod">#</a></h4>
<div class="inherited-from">inherited from Object </div><div class="doc">
<p><code>noSuchMethod</code> is invoked when users invoke a non-existant method
on an object. The name of the method and the arguments of the
invocation are passed to <code>noSuchMethod</code>. If <code>noSuchMethod</code>
returns a value, that value becomes the result of the original
invocation.</p>
<p>The default behavior of <code>noSuchMethod</code> is to throw a
<code>noSuchMethodError</code>.</p>
<pre class="source">
external Dynamic noSuchMethod(String name, List args);
</pre>
</div>
</div>
<div class="method inherited"><h4 id="Object">
<button class="show-code">Code</button>
const <strong>Object</strong>() <a class="anchor-link" href="#Object"
              title="Permalink to DebugDraw.Object">#</a></h4>
<div class="inherited-from">inherited from Object </div><div class="doc">
<p>Creates a new <code>Object</code> instance.</p>
<p><code>Object</code> instances have no meaningful state, and are only useful
through their identity. An <code>Object</code> instance is equal to itself
only.</p>
<pre class="source">
const Object();
</pre>
</div>
</div>
<div class="method"><h4 id="setCamera">
<button class="show-code">Code</button>
void <strong>setCamera</strong>(num x, num y, num scale) <a class="anchor-link" href="#setCamera"
              title="Permalink to DebugDraw.setCamera">#</a></h4>
<div class="doc">
<p>Sets the center of the viewport to the given x and y values and the
viewport scale to the given scale.</p>
<pre class="source">
void setCamera(num x, num y, num scale) {
  viewportTransform.setCamera(x,y,scale);
}
</pre>
</div>
</div>
<div class="method inherited"><h4 id="toString">
<button class="show-code">Code</button>
String <strong>toString</strong>() <a class="anchor-link" href="#toString"
              title="Permalink to DebugDraw.toString">#</a></h4>
<div class="inherited-from">inherited from Object </div><div class="doc">
<p>Returns a string representation of this object.</p>
<pre class="source">
external String toString();
</pre>
</div>
</div>
</div>
        </div>
        <div class="clear"></div>
        </div>
        
        <div class="footer">
          
        </div>
        <script async src="../client-live-nav.js"></script>
        </body></html>
        
